import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { SPetInfo } from "../../../Message/Game/SPetInfo";
type int = number;
//class PetExperienceConfig
    
    export  class PetExperienceConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            if (PetExperienceConfig._instance != null) 
            {
                throw new Error(" ResConfig 单例 ");
            }
            this.init();
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=0;
            var loc3=arg1;
            for(loc1 of loc3) 
            {
                this._map[loc1.level] = loc1.upgradeNeedExperience;
            }
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_pet_experience.json");
            this.write(loc1);
            return;
        }

        public getValueByLevel(arg1: int): number
        {
            return this._map[arg1];
        }

        public static get instance(): PetExperienceConfig
        {
            if (PetExperienceConfig._instance == null) 
            {
                PetExperienceConfig._instance = new PetExperienceConfig();
            }
            return PetExperienceConfig._instance;
        }

        public static getLevel(arg1: SPetInfo): int
        {
            if (arg1) 
            {
                if (arg1.level < 10) 
                {
                    return int(arg1.reinLevel + "00" + arg1.level);
                }
                if (arg1.level >= 100) 
                {
                    return int(arg1.reinLevel + "" + arg1.level);
                }
                return int(arg1.reinLevel + "0" + arg1.level);
            }
            return 0;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: PetExperienceConfig;
    }
